﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once

#include "GcmpDevService.h"
#include <map>

#pragma warning( push )
#pragma warning( disable : 4251 )

#ifndef EMSCRIPTEN
extern const wchar_t* TR_MODULE_NAME;
#else
#include "GbmpGuid.h"
static const wchar_t* TR_MODULE_NAME = L"";
static const Guid MODULE_ID = { 0x7b82001, 0x20ea, 0x4d52,{ 0xb2, 0x99, 0x88, 0x46, 0x26, 0x4e, 0x2b, 0x84 } };
#endif

namespace gcmp
{
    /// \brief 国际化字符串转换管理器
    class GCMP_DEV_SERVICE_EXPORT TranslatorManager
    {
        CANNOT_COPY_OR_ASSIGN(TranslatorManager);
    private:
        TranslatorManager();
    public:
        ~TranslatorManager();

        /// \brief  获取国际化字符串转换管理器
        /// \return 
        static const TranslatorManager* Get();

        /// \brief 转换字符串
        /// \param moduleName  模块名
        /// \param sourceText  源字符串
        /// \return  转换后的字符串
        std::wstring Translate(const std::wstring &moduleName,const std::wstring &sourceText) const;
    };
}
#ifndef EMSCRIPTEN
#define GBMP_TR(str) gcmp::TranslatorManager::Get()->Translate(TR_MODULE_NAME,str)
#else
#define GBMP_TR(str) gcmp::TranslatorManager::Get()->Translate(L"",str)
#endif
#pragma warning( pop )
